<?php

use yii\helpers\Html;
use yii\grid\GridView;
use yii\widgets\ActiveForm;

/* @var $this yii\web\View */
/* @var $dataProvider yii\data\ActiveDataProvider */

$this->title = '角色权限';
$this->params['breadcrumbs'][] = ['label' => '角色', 'url' => ['quanxian']];
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="backend-user-index">
    <div class="table-responsive">
        <?php $form = ActiveForm::begin(); ?>
            <?= Html::hiddenInput('id',Yii::$app->request->get('id')) ?>
            <table class="table table-bordered" style="text-align: center">
                <thead>
                </thead>
                <tbody>
                    <? foreach ($permission as $k=>$v){ ?>
                        <tr>
                            <td><?= $v['lable'] ?></td>
                            <td>
                                <? foreach ($v['child'] as $cv){ ?>
                                    <div><?= $cv['lable'] ?></div>
<!--                                    --><?// foreach ($cv['child'] as $ccv){ ?>
<!--                                        <div>--><?//= '∟'.$ccv['lable'] ?><!--</div>-->
<!--                                    --><?//}?>
                                <?}?>
                            </td>
                            <td>
                                <? foreach ($permissiongroup as $pk=>$pv){ ?>
                                    <?if($k==$pk){?>
                                        <? foreach ($pv as $pvk=>$pvv){ ?>
                                            <?if(current($pvv)!=''){?>
                                                <?=Html::checkboxList('permission',$checkper,$pvv) ?>
                                            <?}else{?>
                                                <div></div>
                                        <?}}?>
                                    <?}?>
                                <?}?>
                            </td>
                        </tr>
                    <?}?>
                </tbody>
            </table>

            <div class="form-group">
                <?= Html::submitButton('保存') ?>
            </div>
        <?php ActiveForm::end(); ?>
    </div>


</div>
